package com.yeu.action;

import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.yeu.model.Evidence;
import com.yeu.util.SecurityCode;
import com.yeu.util.SecurityImage;

public class VerifyAction extends ActionSupport implements ModelDriven<Evidence>,SessionAware{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Evidence verify=new Evidence();
	private Map<String, Object> session;
	private String rc;
	public void setRc(String rc) {
		this.rc = rc;
	}

	@Override
	public void setSession(Map<String, Object> session) {
		this.session=session;
	}
	
	@Override
	public Evidence getModel() {
		return this.verify;
	}
	
	public Evidence getVerify() {
		return verify;
	}
	
	public String login(){
		String securityCode = SecurityCode.getSecurityCode();
		verify.setFileStream(SecurityImage.getImageAsInputStream(securityCode));
		session.put("verify", securityCode);
		verify.setFileFileName("verify.jpg");
		verify.setFileContentType("image/jpeg");
		return INPUT;
	}
}
